﻿using UnityEngine;
using System.Collections;

public class mainGUI2 : MonoBehaviour
{


	public int currentItemID;
	public Texture2D[] itemTexture;
	public string[] itemString = {"Attack","Damage","Support","Rate","Armor","Evasion"} ;
	public int[] theValues;
	public GUIStyle highlightStyle;

	void Awake ()
	{
		int N = 6;
		currentItemID = 0;
		itemTexture = new Texture2D[N];
		theValues = new int[N];
		for (int i=0; i<N; i++)
			theValues [i] = 5;
		highlightStyle = new GUIStyle ();
		highlightStyle.onNormal.textColor = Color.red;
	}

	void OnGUI ()
	{
		int N = theValues.Length;
//theValues[0]=ship.attack;
//select the button
		for (int i=0; i<N; i++) {
			if (i == currentItemID)
				GUI.Button (new Rect (110 + 100 * i, 110, 80, 80), itemString [i], highlightStyle);
			else if (GUI.Button (new Rect (110 + 100 * i, 110, 80, 80), itemString [i]))
				currentItemID = i;
		}
/*
*/
		switch (currentItemID) {
		case 0:
			GUI.Box (new Rect (100, 200, 600, 400), itemString [currentItemID]);
			GUI.Box (new Rect (300, 300, 100, 80), theValues [currentItemID].ToString ());
			if (GUI.Button (new Rect (200, 400, 100, 100), "+"))
				theValues [currentItemID] += 10;
			if (GUI.Button (new Rect (400, 400, 100, 100), "-"))
				theValues [currentItemID] -= 10;
			if (theValues [currentItemID] > 100)
				theValues [currentItemID] = 100;
			if (theValues [currentItemID] < 0)
				theValues [currentItemID] = 0;
			break;
		case 1:
			GUI.Box (new Rect (100, 200, 600, 400), itemString [currentItemID] + " can't be changed dude");
			break;
		case 2:
			GUI.Box (new Rect (100, 200, 600, 400), itemString [currentItemID] + " not reached level 7 yet...");
			break;
		case 3:
		case 4:
		case 5:
			GUI.Box (new Rect (100, 200, 600, 400), itemString [currentItemID]);
			GUI.Box (new Rect (300, 300, 100, 80), theValues [currentItemID].ToString ());
			if (GUI.Button (new Rect (200, 400, 100, 100), "+"))
				theValues [currentItemID] += 1;
			if (GUI.Button (new Rect (400, 400, 100, 100), "-"))
				theValues [currentItemID] -= 1;
			if (theValues [currentItemID] > 10)
				theValues [currentItemID] = 10;
			if (theValues [currentItemID] < 0)
				theValues [currentItemID] = 0;
			break;


		}
//ship.attack=theValues[0];
	}
}